﻿#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
double func(double a, double b, double c, double d, double x) {
    return a * x * x + b * x * x + c * x + d;
}
int main() {
    double a, b, c, d, lowerLimit, upperLimit, step;
    printf("请输入 a、b、c、d 的值：");
    scanf("%lf %lf %lf %lf", &a, &b, &c, &d);
    printf("请输入积分下限：");
    scanf("%lf", &lowerLimit);
    printf("请输入积分上限：");
    scanf("%lf", &upperLimit);
    printf("请输入积分步长（需大于 0 且小于 0.1）：");
    scanf("%lf", &step);
    if (step <= 0 || step >= 0.1) {
        printf("积分步长不符合要求。\n");
        return 1;
    }
    double sum = 0.0;
    for (double x = lowerLimit; x < upperLimit; x += step) {
        sum += (func(a, b, c, d, x) + func(a, b, c, d, x + step)) * step / 2;
    }
    printf("定积分结果为：%lf\n", sum);
    return 0;
}